<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>原型的不同写法</title>
</head>
<body>
    <script>
        function Person() {}
        // Person.prototype.name = 'name'
        // Person.prototype.age = 'age'
        // Person.prototype.eat = _ => {}
        // Person.prototype.play = _ => {}
        
        Person.prototype = {
            constructor:Person, // 构造器指向修正
            name:'name',
            age:'age',
            eat:function() {},
            play:function() {}
        }

    </script>
</body>
</html>